package com.itcast.demo.validate.controller;

import com.itcast.demo.validate.pojo.User;
import jakarta.annotation.Nonnull;
import jakarta.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/validate")
@Validated
public class ValidateController {
    // 单个参数校验  注意： 在进行单个参数校验时，一定要在Controler类上加@Validated注解，否则校验不会生效。
    @GetMapping("/test1")
    public void test1(@NotNull(message = "参数不能为空") String name) {
        System.out.println("test1");
    }




}
